public class 最大宽度坡 {

    public static int MAXN = 50001;
    public static int[] stack = new int[MAXN];
    public static int r;
    public int maxWidthRamp(int[] nums) {
        int n = nums.length;

        for (int i = 0; i < n; i++) {
            if (r == 0 || nums[stack[r - 1]] < nums[i]) {
                stack[r++] = i;
            }
        }

        return 1;
    }
}
